/*******************************************************************************
New Unit Technologies, a division of DBI, LLC.

Created for CS450 at West Virginia University, Fall 2003

Developers:	Matthew Bradley
		Andrew Lowery
		Richard Paletta
		J. Ryan Sigler

File name: comhan.h
*******************************************************************************/

/******************************************************************************/
#ifndef COMHAN_H
#define COMHAN_H

#include "PCB.H"

// Number of commands (MUST be changed when adding commands)
#define NUMCOMMANDS 20
/******************************************************************************/
//Global Constants
#define MAX_CMD_LEN 15
#define MAX_NUM_ARGS 45
#define MAX_ARG_LEN 60
#define MAX_HIST_LEN 5
/******************************************************************************/
// Function Prototypes
int comhan(void);
int help(void);
int date(void);
int version(void);
int quit(void);
int list(void);
int unpackcommand(char command[]);
void createpcb(void);
void deletepcb(void *pcbtodel);
void block(void);
void unblock(void);
void suspend(void);
void resume(void);
void setpriority(void);
void showpcb(void);
void showall(void);
void showready(void);
void showblocked(void);
int dispatchcmd(void);
void loadp(void);
void terminate(void);
void blockPCB(PCB *pcb);
void unblockPCB(PCB *pcb);
//int put_in_hist(char command[]);
//int history(void);  to be implemented later


static char name[NUMCOMMANDS][MAX_CMD_LEN] = {"help", "date", "version", "quit", "list","createpcb", "deletepcb", "block", "unblock", "suspend", "resume", "setpriority", "showpcb", "showall", "showready", "showblocked", "dispatchcmd", "loadp", "terminate"};
static int (*fp[NUMCOMMANDS])(void) = {help, date, version, quit, list, createpcb, deletepcb, block, unblock, suspend, resume, setpriority, showpcb, showall, showready, showblocked, dispatchcmd, loadp, terminate};


//Global Variables

// Command Buffer
struct {
	int	args;
	char	name[MAX_CMD_LEN+1];
	char	arg[MAX_NUM_ARGS][MAX_ARG_LEN+1];
} commandline;


//quit confirmation buffer
char confirm_quit[10];

//for use with history function
//char hist_buff[MAX_HIST_LEN][50];
//int hist_size=0;

#endif
